﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HexEditor_
{
    public abstract class ViewInterface
    {
        public HexEditor Editor { get; set; }
        public ConsoleProgram Program { get; set; }


        public void SetDoc(ConsoleProgram prog, HexEditor editor)
        {
            Editor = editor;
            Program = prog;
            Initialize();
            OnDocUpdated();
        }

        public abstract void Initialize();

        public abstract void OnDocUpdated(Int64 begin = -1, Int64 end = -1);
    }

    public abstract class HexEditView : ViewInterface
    {
        //当前位置
        public Int64 CurPos{get;set;}    

        //页面大小
        public int BytesPerLine{get;set;}
        public int PageLines{get;set;}
        public Int64 TotalLines { get; set; }

        //光标位置
        public int CursorPosX{get;set;}
        public int CursorPosY { get; set; }

        public HexEditView()
        {
            CurPos = 0;
            BytesPerLine = 8;
            PageLines = 16;
            CursorPosX = CursorPosY = 0;
        }

        public override void OnDocUpdated(Int64 begin = -1, Int64 end = -1)
        {

        }

        //public abstract void BeginPrint();
        //public abstract void PrintLocation(int nLine, Int64 loc);
        //public abstract void PrintBytes(int nLine, byte[] bytes, int noffset, int ncount);
        //public abstract void PrintResult(int nLine, byte[] bytes, int noffset, int ncount);
        //public abstract void EndPrint();
    }
}
